Don't send the old state string for halted domains -- it doesn't make any
authorEwan Mellor <ewan@xensource.com>
Mon, 27 Nov 2006 14:48:38 +0000 (14:48 +0000)
committerEwan Mellor <ewan@xensource.com>
Mon, 27 Nov 2006 14:48:38 +0000 (14:48 +0000)
sense, and we don't want to see state flags linger.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendConfig.py

index ad5e0ad4a3e699d729b99e88959b2a405b019b2f..da7898c72c3bb15acd1634dee7bb37ffa2093ecf 100644 (file)
@@ -685,15 +685,15 @@ class XendConfig(dict):
         # TODO: domid/dom is the same thing but called differently
         #       depending if it is from xenstore or sxpr.
 
-        if domain.getDomid() != None:
+        if domain.getDomid() is not None:
             sxpr.append(['domid', domain.getDomid()])
 
         for cfg, typefunc in ROUNDTRIPPING_CONFIG_ENTRIES:
             if cfg in self:
-                if self[cfg] != None:
+                if self[cfg] is not None:
                     sxpr.append([cfg, self[cfg]])
 
-        if 'image' in self and self['image'] != None:
+        if 'image' in self and self['image'] is not None:
             sxpr.append(['image', self['image']])
         if 'security' in self and self['security']:
             sxpr.append(['security', self['security']])
@@ -714,7 +714,9 @@ class XendConfig(dict):
         else:
             sxpr.append(['status', str(DOM_STATE_HALTED)])
 
-        sxpr.append(['state', self._get_old_state_string()])
+        if domain.getDomid() is not None:
+            sxpr.append(['state', self._get_old_state_string()])
+
         sxpr.append(['memory_dynamic_max', self.get('memory_dynamic_max',
                                                     self['memory'])])